package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Third_a;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Third_aMapper {
    @Select({
            "select",
            "*",
            "from Third_a",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Third_a> selectByName(String oName);
    @Delete({
            "delete from Third_a",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);
    @Delete({
        "delete from third_a",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into third_a (hospital, project, ",
        "unit, count, remark)",
        "values (#{hospital,jdbcType=VARCHAR}, #{project,jdbcType=VARCHAR}, ",
        "#{unit,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Third_a record);

    int insertSelective(Third_a record);

    @Select({
        "select",
        "id, hospital, project, unit, count, remark",
        "from third_a",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Third_a selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Third_a record);

    @Update({
        "update third_a",
        "set hospital = #{hospital,jdbcType=VARCHAR},",
          "project = #{project,jdbcType=VARCHAR},",
          "unit = #{unit,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR},",
          "remark = #{remark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Third_a record);

    int insertBatch(List<Third_a> item);
}